package com.taglab.chic.atom;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * 
 * @author Markus Kobler
 */
public class AtomFeed extends BaseAtomElement {

  private static final long serialVersionUID = 7326833454752998262L;
  
  private String subTitle;
  private String logo;
  private String icon;

  private List<AtomEntry> entries;

  public AtomFeed(String id, String title) {
    super(id, title);
    this.entries = new ArrayList<AtomEntry>();
  }

  public AtomFeed(String id, String title, Collection<AtomEntry> entries) {
    super(id, title);
    this.entries = new ArrayList<AtomEntry>(entries.size());
    addEntries(entries);
  }

  public List<AtomEntry> getEntries() {
    return Collections.unmodifiableList(entries);
  }

  public void addEntry(AtomEntry entry) {
    entries.add(entry);
    // XXX not sure this is correct behaviour
//    if( entry.getUpdated() != null && updated.before(entry.getUpdated()) ) { // XXX what about published
//      updated = entry.getUpdated();
//    }
  }
  
  public void addEntries(Collection<AtomEntry> entries) {
    for( AtomEntry entry : entries) addEntry(entry);
  }


  public String getSubTitle() {
    return subTitle;
  }

  public void setSubTitle(String subTitle) {
    this.subTitle = subTitle;
  }

  public String getLogo() {
    return logo;
  }

  public void setLogo(String logo) {
    this.logo = logo;
  }

  public String getIcon() {
    return icon;
  }

  public void setIcon(String icon) {
    this.icon = icon;
  }
  
}
